home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / crobots7 / twedledm.r < prev   
Text File  |  1988-07-15  |  1KB  |  36 lines

  1. /* Tweedlee Dum */
  2. /* By Eric Maddox */
  3. /* This goes to the east wall then moves up and down while it */
  4. /* scans and fires west. */
  5. main (){
  6.  while (loc_x() < 940 ) drive (0,100);
  7.  while (loc_x() < 950 ) drive (0,50);  /* go to east wall */
  8.  while (loc_x() < 985 ) drive (0,25);
  9.  while (loc_x() < 994  ) drive (0,10);
  10.  drive (180,0); /* stop */
  11.      while (1) /* infinite loop */
  12.            {
  13.            while (loc_y() < 900)
  14.                  {
  15.                   drive (90,100); /* go up */
  16.                   fire();   /* scan and fire west */
  17.                  }
  18.            while (loc_y() > 100)
  19.                  {
  20.                   drive (270,100);  /* go down */
  21.                   fire();  /* scan and fire west */
  22.                  }
  23.            }
  24. } /*main*/
  25. fire ()
  26. {int range;
  27. range=scan(175,5);
  28. while ((range > 0) && (range < 700) && (loc_y() < 950))
  29.       {cannon(175,range);range=scan(175,5);}
  30. range=scan(180,5);
  31. while ((range > 0) && (range < 700)) {cannon(180,range);range=scan(180,5);}
  32. range=scan(185,5);
  33. while ((range > 0) && (range < 700) && (loc_y() > 50))
  34.       {cannon(185,range);range=scan(185,5);}
  35. }
  36.